<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>命名视图</title>
    
    <script src="./../vue/vue.js"></script>
    <script src="./../vue/vue-router.js"></script>
</head>
<body>

    <div id="app">

        <div>

        </div>
        <div>
            <router-view></router-view>
            <router-view name="a"></router-view>
            <router-view name="b"></router-view>
        </div>
        
    </div>

    <script>

        const componentTemp = {
            template: `
            <div>TTTTTTT</div>
            `
        }

        const componentDefault = {
            template: `
            <div>
                componentDefault
                <router-view></router-view>
            </div>
            `
        }

        const componentA = {
            template: `
            <div>componentA</div>
            `
        }

        const componentB = {
            template: `
            <div>componentB</div>
            `
        }
        
        const router = new VueRouter({
            routes: [
                {
                    path: "/",
                    components: {
                        default: componentDefault,
                        a: componentA,
                        b: componentB
                    },
                    children: [
                        {
                            path: 'tt',
                            component: componentTemp
                        }
                    ]
                },
                {
                    path: '/temp',
                    component: componentDefault,
                    children: [
                        {
                            path: 'tt',
                            component: componentTemp
                        }
                    ]
                }
            ]
        })

        let vm = new Vue({
            router,
            el: "#app",
            data: {

            },
            methods: {
                
            },
        })

    </script>
    
</body>
</html>